<?php

class languageComponents extends sfComponents
{
  public function executeLanguage(sfWebRequest $request)
  {
//    $this->form = new sfFormLanguage(
//      $this->getUser(),
//      array('languages' => sfConfig::get('app_avalible_languages'))
//    );
    $this->form = new sfForm();
     
    foreach (sfConfig::get('app_avalible_languages') as $key => $value)
    {
      $languages[] = print "<div>$value</div>";
    }
    
    $this->form->setWidgets(array(
      'language'   => new sfWidgetFormSelectRadio(array('choices'=>$languages))
    ));    
  }
  
  public function executeLanguage_selector(sfWebRequest $request)
  {
    foreach (sfConfig::get('app_avalible_languages') as $key => $value)
    {
      $languages[$key]['label'] = __($key);
      $languages[$key]['url'] = url_for('localized_index',array('sf_culture' => $value, 'table'=>$request->getParameter('table')));
      $languages[$key]['img'] = 'flag_' . $value . '.jpg';
    }
    
    $this->languages = $languages;
  }
}